package com.ets.dao.impl;

import java.util.List;

import org.hibernate.*;
import org.springframework.stereotype.Repository;

import com.ets.dao.StuResultDao;
import com.ets.entity.StuResult;
@Repository
public class StuResultDaoImpl extends BaseDaoImpl implements StuResultDao {

	@Override
	public void add(StuResult result) {
		Session session=getSession();
		session.save(result);
		
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<StuResult> getAll() {
		String hql="from StuResult";
		return getSession().createQuery(hql).list();
	}

	@Override
	public void delete(int id) {
		Session session=getSession();
		session.delete(session.get(StuResult.class, id));
		session.flush();
		session.close();
	}

}
